# @Version : 1.0
# @Author  : 刘宇
# @File    : test02.py
# @Time    : 2025/10/7 23:48


# 打印空心菱形
"""
1.打印一个矩形
*********
*********
*********
*********
*********

2.
*
**
***
****
*****

3.
    *   4
   **   3
  ***   2
 ****   1
*****   0

4.
    *    4  0
   * *   3  1
  *  *   2  2
 *   *    1  3
*    *    0
"""
# i控制层数
i=1
for i in range(1,6):
    for k in range(5-i):
        print(" ",end="")
    # j控制*
    for j in range(2*i-1):
        if j==0 or j==2*(i-1)  :
            print("*",end="")
        else:
            print(" ",end="")
    print(" ")

# 下半部分：打印菱形下半部分（后4行）
for i in range(4, 0, -1):
    for k in range(5 - i):
        print(" ", end="")
    for j in range(2 * i - 1):
        if j == 0 or j == 2 * (i - 1):
            print("*", end="")
        else:
            print(" ", end="")
    print(" ")

